<?php

namespace app\wx\common;
use app\wx\model\Wxgroup;

class WxIndex
{
    /**
     * 根据id获取微信分组
     */
    public function getGroup($groupname=''){
        //获取当前用户id
        $user = get_admin_session();
        $wxgroup = new Wxgroup();
        if (!empty($groupname)) {
            $wxList = $wxgroup->where('userid',$user['id'])->where('groupname',$groupname)->order('id DESC')->select()->toArray();
        }else{
            $wxList = $wxgroup->where('userid',$user['id'])->order('id DESC')->select()->toArray();
        }
        
        return lay_msg(0,'success',count($wxList),$wxList);
    }


}
